<extend name="Index/index"/>

<block name="content">
    <!--<div class="view-product" style="margin-top: 50px">-->
    <div class="info-center">
        <div class="manage-head">
            <h6 class="padding-left manage-head-con">{{$title}}</h6>
        </div>
        <a href="{{$prev}}" class="layui-btn layui-btn-normal" style="margin: 20px 0 0 20px">返回上一页</a>
        <div class="layui-container" style="margin-top: 20px">
            <div class="layui-row">

                <div class="layui-col-md5 layui-col-md-offset1">
                    <form class="layui-form" action="{{:U('Article/saveArt')}}" method="post" enctype="multipart/form-data" id="add">
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title"  autocomplete="off" class="layui-input" lay-verify="required" required>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">简短描述(文字)</label>
                            <div class="layui-input-inline">
                                <input type="text" name="description"  autocomplete="off" class="layui-input" lay-verify="required" required>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">缩略图</label>
                            <div class="layui-input-inline">
                                <input type="file" name="photo"  autocomplete="off"lay-verify="required">
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-inline">
                                <script id="editor" name = "content" type="text/plain" style="width:1024px;height:500px;"></script>                                       </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                <button class="layui-btn" lay-submit >立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                                </div>
                                </form>

                                </div>
                                </div>
                                </div>
                                <script>
                            var ue = UE.getEditor('editor',{  //intro_detail为要编辑的textarea的id
                                initialFrameWidth: 1000,  //初始化宽度
                                initialFrameHeight: 300,  //初始化高度
                            });
                            ue.ready(function(){
                                ue.setHeight(300);
                            });

                            // Demo
                            layui.use('form', function(){
                                var form = layui.form;

                                //监听提交
                                form.on('submit(formDemo)', function(data){
                                    layer.msg(JSON.stringify(data.field));
                                    return false;
                                });
                            });
                            layui.use('laydate', function(){
                                var laydate = layui.laydate;
                                //日期时间选择器
                                laydate.render({
                                    elem: '#test1'
                                    ,type: 'month'
                                });
                                laydate.render({
                                    elem: '#test2'
                                    ,type: 'month'

                                });
                                laydate.render({
                                    elem: '#test3'
                                });
                                laydate.render({
                                    elem: '#test4'

                                });
                            });
                            $("#add").submit(function(){
                                // var s=ue.getPlainTxt();
                                // alert(s.length > 1);
                                // return false;
                                var s=ue.getPlainTxt();
                                if(s.length > 1){
                                    return false;
                                }else{
                                    layer.alert("内容不能为空");
                                    return false;
                                }
                            })
                                </script>

                            </div>
                            <!--</div>-->

</block>